{% extends "base.html" %}

{% block content %}
<div class="container py-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card shadow-sm">
                <div class="card-body">
                    <h2 class="card-title mb-4">添加运动记录</h2>
                    <form method="post">
                        <div class="row g-3">
                            <div class="col-md-6">
                                <label for="exercise_date" class="form-label">日期</label>
                                <input type="date" class="form-control" id="exercise_date" name="exercise_date" 
                                       required value="{{ today }}">
                            </div>
                            <div class="col-md-6">
                                <label for="exercise_time" class="form-label">时间</label>
                                <input type="time" class="form-control" id="exercise_time" name="exercise_time" 
                                       required value="{{ current_time }}">
                            </div>
                            <div class="col-md-6">
                                <label for="exercise_type" class="form-label">运动类型</label>
                                <select class="form-select" id="exercise_type" name="exercise_type" required>
                                    <option value="跑步">跑步</option>
                                    <option value="游泳">游泳</option>
                                    <option value="骑行">骑行</option>
                                    <option value="健身">健身</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>
                            <div class="col-md-6">
                                <label for="intensity" class="form-label">运动强度</label>
                                <select class="form-select" id="intensity" name="intensity" required>
                                    <option value="低强度">低强度</option>
                                    <option value="中强度">中强度</option>
                                    <option value="高强度">高强度</option>
                                </select>
                            </div>
                            <div class="col-md-6">
                                <label for="duration" class="form-label">运动时长(分钟)</label>
                                <input type="number" class="form-control" id="duration" name="duration" 
                                       required min="1" step="1">
                            </div>
                            <div class="col-md-6">
                                <label for="calories_burned" class="form-label">消耗热量(kcal)</label>
                                <input type="number" class="form-control" id="calories_burned" name="calories_burned" 
                                       min="0" step="1">
                            </div>
                            <div class="col-md-6">
                                <label for="distance" class="form-label">运动距离(km)</label>
                                <input type="number" class="form-control" id="distance" name="distance" 
                                       min="0" step="0.01">
                            </div>
                            <div class="col-12">
                                <label for="note" class="form-label">备注</label>
                                <textarea class="form-control" id="note" name="note" rows="3"></textarea>
                            </div>
                            <div class="col-12">
                                <div class="d-grid gap-2">
                                    <button type="submit" class="btn btn-primary">保存</button>
                                    <a href="{{ url_for('main.exercise_records') }}" class="btn btn-secondary">返回</a>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 